<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
    <h3>初次登录</h3>
    <pre>
        {:print_r($user)}
    </pre>
    <form action="{:url('doOutsideRegister')}" method="post">
        <div>
            <label for="mobile">手机号</label>
            <input type="text" name="mobile" id="mobile" value="{$user.mobile}">
        </div>
        <div>
            <label for="code">验证码</label>
            <input type="text" name="code" id="code">
            <button type="button" onclick="sendMobileCode('#mobile')">发送</button>
        </div>
        <input type="hidden" name="id" value="{$id}">
        <button>创建账号</button>
        <a href="{$bind_account_url}">绑定已有账号</a>
    </form>
    <script>
        function sendMobileCode(selector){
            var mobile=$(selector).val();
            if(!mobile){
                alert("手机号不能为空");
                return false;
            }
            $.post("{:url('user/sms/sendRegisterCode')}",{"mobile":mobile},function(data){
                alert(data.msg);
            });
        }
    </script>
</body>
</html>
